# -*- coding: utf-8 -*-

from enum import Enum
from datetime import datetime
from pydantic import BaseModel
from typing import Any, Dict

from schemas.base import BaseModelMixin

class AttachmentCategory(str, Enum):
    image = "image"
    video = "video"
    audio = "audio"
    file = "file"

# 0: created, 1: uploading, 2: success, 3: failed, 
class AttachmentStatus(int, Enum):
    created = 0
    uploading = 1
    success = 2
    failed = 3


class AttachmentBase(BaseModel):    
    name: str | None = None
    category: AttachmentCategory | None = None
    content_type: str | None = None
    size: int | None = None
    hash: str | None = None
    class Config:
        from_attributes = True


class AttachmentCreate(AttachmentBase):
    pass

class AttachmentUpdate(AttachmentBase):
    pass

class Attachment(AttachmentBase, BaseModelMixin):
    status: AttachmentStatus | None = None
    url: str | None = None
    class Config:
        from_attributes = True

# 0: failed, 1: success,
class AttachmentSegmentStatus(int, Enum):
    failed = 0
    success = 1

class AttachmentSegment(BaseModel):
    hash: str | None = None
    status: int | None = None
    class Config:
        from_attributes = True

